﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;

namespace ConfExpert.Forms.Depo
{
    public partial class HLUretimOzet : XForm
    {
        public HLUretimOzet()
        {
            InitializeComponent();
        }

        private void HLUretimOzet_Load(object sender, EventArgs e)
        {
            this.Text = "HL Uretim İstatistikleri";

            gridView1.Init("GetHL2Uretim_Ozet2");
            gridView1.AddDetailGrid(gridView2, "CustomerId");
            DevExpress.XtraGrid.Columns.GridColumn col = gridView1.Columns["UretiminHLyeOrani"];
            col.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
            col.DisplayFormat.FormatString = "P1";

           // gridView1.Columns["UretiminHLyeOrani"].VisibleIndex = 1;
            gridView1.Columns["UretiminHLyeOrani"].ToolTip = "Üretimin HL'ye Oranı";
            ///gridView1.FormatAsPercentage("UretiminHLyeOrani");
            gridView1.SetCaptions("UretiminHLyeOrani:Üretim/HL");

            gridView2.FormatAsNumber(1, "NumuneQty", "KoleksiyonQty", "UretimQty");
            gridView1.MakeRowSelectable();
            gridView1.MakeColumnsReadOnly("CustomerId", "HL", "Numune", "Koleksiyon", "Uretim", "UretiminHLyeOrani");
            gridView2.MakeColumnsReadOnly("PONr", "CustomerId", "ProductId", "KompozisyonId", "Konstruksiyon", "FinishId", "KaliteId", "NumuneQty", "KoleksiyonQty", "UretimQty");
            gridView1.AddSummary("HL","Numune", "Koleksiyon", "Uretim");
            gridView2.AddSummary("NumuneQty", "KoleksiyonQty", "UretimQty");
            gridView1.BestFitColumns();
            gridView2.BestFitColumns();

            gridView1.FocusedRowChanged += gridView1_FocusedRowChanged;
        }

        void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            gridView2.BestFitColumns();
        }
    }
}
